package client.test.ihm;

import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.rmi.RemoteException;

import serveurChatRMI.rmi.interfaces.InterfaceSujetDiscussion;
import client.test.ImplAffichageClient;
import clientInterfaces.InterfaceAffichageClient;

public class WindowListenerCloseChat implements WindowListener {

	
	InterfaceAffichageClient iac;
	InterfaceSujetDiscussion sd;
	
	public WindowListenerCloseChat(ImplAffichageClient iac,
			InterfaceSujetDiscussion sd) {
		this.iac=iac;
		this.sd=sd;
	}

	@Override
	public void windowActivated(WindowEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowClosed(WindowEvent e) {
		try {
			sd.desInscription(iac);
		} catch (RemoteException e1) {
			e1.printStackTrace();
		} catch(Exception e1) {
			e1.printStackTrace();
		}
	}

	@Override
	public void windowClosing(WindowEvent e) {
		try {
			sd.desInscription(iac);
		} catch (RemoteException e1) {
			e1.printStackTrace();
		} catch(Exception e1) {
			e1.printStackTrace();
		}
		
		
	}

	@Override
	public void windowDeactivated(WindowEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowDeiconified(WindowEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowIconified(WindowEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void windowOpened(WindowEvent e) {
		// TODO Auto-generated method stub

	}

}
